<?php 
class APPFModelContent extends APPObject 
{
	var $data	=	array();
	var $item	=	null;
	var $images	=	array();
	function APPFModelContent()
	{
		
	}
	function getContent()
	{
		if ($this->item)
			return $this->item;
		$db		=	Factory::getDBO();
		$cid	=	Request::getInt('cid',0);
		
		$query	=	'SELECT * FROM `#__fcontent` WHERE id = '. $db->quote($cid).
							'	AND state = 1';
		$db->setQuery($query);
		$this->item	=	$db->loadObject();
		
		$query	=	'UPDATE `#__fcontent_receive` '.
					'	SET hits = hits + 1'.
					' WHERE cid ='. $db->quote($cid);
		$db->setQuery($query);
		$db->query();
		return $this->item;
	}
	function getImages()
	{
		if ($this->images)
			return $this->images;
		$db		=	Factory::getDBO();
		$cid	=	Request::getInt('cid',0);
		
		$query	=	'SELECT * FROM `#__fmedia` WHERE cid = '. $db->quote($cid).
							'	AND state = 1'.
							'	ORDER BY ordering ';
		$db->setQuery($query);
		$this->images	=	$db->loadObjectList();
		return $this->images;
	}
}













?>